package hu;

import java.util.*;

public class Main2 {
    static int ans = Integer.MAX_VALUE;
    static boolean flag = false;
    static int smml;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int b = sc.nextInt();
        int e = sc.nextInt();
        int ssl = sc.nextInt();
        int[][] road = new int[n + 1][n + 1];
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int d = sc.nextInt();
            int f = sc.nextInt();
            road[a][d] = f;
            road[d][a] = f;
        }

        int[] used = new int[n + 1];
        smml = ssl;
        used[b] = 1;
        dfs(road, b, e, ssl, used, 0);
        if(flag){
            System.out.println(-1);
            return;
        }
        System.out.println(ans + " " + smml);
        System.out.println(3/6*2);

    }
    public static void dfs(int[][] road, int index, int e, int ssl, int[] used, int sum){
        if(index == e && ssl >= 0){
            if(ans > sum){
                ans = sum;
                smml = ssl;
            }
            if(ans == sum && smml < ssl)
                smml = ssl;
            return;
        }
        if(index != e && ssl <= 0){
            flag = true;
            return;
        }
        for (int i = 1; i < road.length; i++) {
            if(road[index][i] != 0 && used[i] == 0){
                used[i] = 1;
                dfs(road, i, e, ssl - 1, used, sum + road[index][i]);
                used[i] = 0;
            }
        }
    }
}
/*
10 1 7 255
1 2 3
1 5 2
1 8 5
2 3 3
2 5 3
3 4 3
4 7 3
5 6 2
6 7 2
8 7 6


10 1 7 1
1 2 3
1 5 2
1 8 5
2 3 3
2 5 3
3 4 3
4 7 3
5 6 2
6 7 2
8 7 6

10 1 7 255
1 2 3
1 8 4
2 8 4
2 3 6
2 5 3
3 8 4
3 4 4
4 5 3
4 7 3
3 7 4
 */
